package com.xxxx.yebserver.config.security;

import com.xxxx.yebserver.common.R;
import com.xxxx.yebserver.common.utils.ResponseUtils;
import org.springframework.security.access.AccessDeniedException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class RestfulAccessDeniedHandler implements org.springframework.security.web.access.AccessDeniedHandler {

    @Override
    public void handle(HttpServletRequest req, HttpServletResponse resp, AccessDeniedException e) throws IOException, ServletException {
        ResponseUtils.out(resp, R.error(403,"权限不足，请联系管理员！"));
    }
}
